/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package myCalculator;

import java.util.*;

/**
 *
 * @author houfukude
 */

   public class Day {//定义一个day类
       int year;
       int month;
       int date;
       public long DayBettwenNow(){//到现在的一个计算方法
           Calendar c = GregorianCalendar.getInstance();
           //int year1900 = 1900;
           //int month1900 = 0;
           //int date1900 = 1;
           //c.set(Calendar.YEAR, year1900);
           //c.set(Calendar.MONTH, month1900);
           //c.set(Calendar.DATE, date1900);
           Date d1 = c.getTime();//获得当前时间
           c.set(Calendar.YEAR, year);//写入年份
           c.set(Calendar.MONTH, month-1);//写入月份
           c.set(Calendar.DATE, date);//写入天数
           Date d2 = c.getTime();//当前输入时间
           long daterange=Math.abs(d1.getTime()-d2.getTime());  //getTime()返回自  now 以来此 Date 对象表示的毫秒数。
           long time=1000*3600*24;     //一天的微秒数
           //System.out.println("两个日期相隔"+daterange/time+"天");
           return daterange/time;//返回与当前的日期差
       }
    
   }